Repository navigation
feat(iam): add public cached GET /v1/iam/stats aggregate endpoint - #89
Merged
Merged
Conversation
Expose public, zero-PII aggregate counts of active Hanzo IAM users and organizations at GET /v1/iam/stats (5m in-process cache, public Cache-Control s-maxage=300 / stale-while-revalidate=3600, fail-closed HTTP 503 when store is unavailable). Add /v1/iam/stats to publicCatalog and authztest open floors so callers like forge.hanzo.ai can display the real account total instead of local seat counts. Co-authored-by: Hanzo Dev <dev@hanzo.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GET /v1/iam/stats(apps/iam/stats.go) returning{"users": <int64>, "organizations": <int64>}with zero PII.IsDeleted == true), cache counts in-process for 5 minutes (keyed perorm.DBinstance), returnCache-Control: public, max-age=300, s-maxage=300, stale-while-revalidate=3600, and fail closed with HTTP 503 when the identity store is unavailable./v1/iam/statsinapps/iam/contract_test.go(authztest.Open) andinternal/host/build.go(publicCatalog, 300s shared edge copy).apps/iam/zipdoc_gen.goviago generate ./apps/iam.TestPublicStatsCountsLiveUsersAndOrgsandTestPublicStatsDegradedReturns503.Validation
go generate ./apps/iamgo test -race -count=1 ./apps/iam/...(includingTestAuthorizationContract,TestComposingRecoveredTheNestedRegistry,TestPublicStats*)go test -count=1 ./internal/host -run 'Test.*(Cache|Shared|Catalog|CORS)'go test -count=1 ./manifest/...